<script lang="ts" setup>
import { useRouter } from 'vue-router';

const router = useRouter();
const imgUrl = 'https://tse2-mm.cn.bing.net/th/id/OIP-C.2w1QtK1OW2OQ-GgscIEnxAHaHa?w=198&h=198&c=7&r=0&o=5&dpr=1.8&pid=1.7'

const data=defineModel()

function toDetail(nid) {
  router.push(`/post/${nid}`)
}

</script>

<template>
  <div class="box">
    <div class="left">
      <img :src="data.imgUrl" alt="" style="width: 100px">
    </div>
    <div class="right">
      <div class="title">
        <span style="display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;">{{data.title}}</span>
      </div>
      <div class="info-item">
        <i class="el-icon-user"></i>
        <span>姓名：{{data.seekerName}}</span>
      </div>
      <div class="info-item">
        <i class="el-icon-date"></i>
        <span>年龄：{{ data.age }}</span>
      </div>
      <div class="info-item">
        <i class="el-icon-time"></i>
        <span>失踪日期：{{ data.missngDate }}</span>
      </div>
      <div class="info-item">
        <i class="el-icon-location"></i>
        <span class="address-text" style="display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;">失踪地点：{{ data.missingAddress }}</span>
      </div>
      <el-button type="warning" class="help-btn" @click="toDetail(data.nid)">
        为ta提供线索
      </el-button>
    </div>
  </div>
</template>

<style scoped>
.box {
  width: 320px;
  height: 200px;
  padding: 15px;
  background-color: #ffffff;
  border-radius: 12px;
  display: flex;
  gap: 15px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.box:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 20px rgba(64, 158, 255, 0.2);
  border: 1px solid rgba(64, 158, 255, 0.4);
}

.left img {
  width: 100px;
  height: 170px;
  object-fit: cover;
  border-radius: 8px;
}

.right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title {
  margin-bottom: 5px;
}

.title span {
  font-size: 18px;
  font-weight: 600;
  color: #303133;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: #606266;
}

.info-item i {
  font-size: 16px;
  color: #909399;
}

.help-btn {
  margin-top: auto;
  width: 100%;
  font-weight: 500;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

.help-btn:hover {
  transform: scale(1.02);
}
</style>